package com.guosen.web.mocker

/**
 * Created by kerry on 2016/10/25.
 */
class Utils {
    public static byte[] readBytes(InputStream is) throws IOException {
        final int BUFFER_SIZE = 4 * 1024
        byte[] buffer = new byte[BUFFER_SIZE]

        ByteArrayOutputStream os = new ByteArrayOutputStream()

        int length = 0
        while ((length = is.read(buffer)) > 0) {
            os.write(buffer, 0, length)
        }

        is.close()
        os.toByteArray()
    }
}
